cssanimatedstyle: Remove some casts in hot paths
authorTimm Bäder <mail@baedert.org>
Sat, 17 Aug 2019 14:12:57 +0000 (16:12 +0200)
committerTimm Bäder <mail@baedert.org>
Mon, 9 Sep 2019 15:36:23 +0000 (17:36 +0200)
gtk_css_animated_style_create_css_transitions down from 16% to 11%
when repeatedly clicking on a spinbutton button in the widget factory.

gtk/gtkcssanimatedstyle.c

index c09ddb01cef4a9ad54572f01d7e3ceaddc72a91a..2b7545184084e7afbd7b4b2b78000f8cdad9a47a 100644 (file)
@@ -195,17 +195,17 @@ transition_info_add (TransitionInfo    infos[GTK_CSS_PROPERTY_N_PROPERTIES],
         {
           GtkCssStyleProperty *prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
 
-          transition_info_add (infos, GTK_STYLE_PROPERTY (prop), index);
+          transition_info_add (infos, (GtkStyleProperty *)prop, index);
         }
     }
   else
     {
       guint id;
 
-      if (!_gtk_css_style_property_is_animated (GTK_CSS_STYLE_PROPERTY (property)))
+      if (!_gtk_css_style_property_is_animated ((GtkCssStyleProperty *) property))
         return;
 
-      id = _gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (property));
+      id = _gtk_css_style_property_get_id ((GtkCssStyleProperty *) property);
       g_assert (id < GTK_CSS_PROPERTY_N_PROPERTIES);
       infos[id].index = index;
       infos[id].pending = TRUE;
@@ -231,7 +231,7 @@ transition_infos_set (TransitionInfo  infos[GTK_CSS_PROPERTY_N_PROPERTIES],
 
           for (j = 0; j < len; j++)
             {
-              property = GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (j));
+              property = (GtkStyleProperty *)_gtk_css_style_property_lookup_by_id (j);
               transition_info_add (infos, property, i);
             }
         }